// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

const int N = 14;

LL dp[N + 1][N][1<<N];

char g[N][N];
bool G[N][N];

int n;

int main(int argc, char const *argv[]) {
    // code
    scanf("%d", &n);
    for (int i=0; i<n; ++i) {
        scanf("%s", g[i]);
        for (int j=0; j<n; ++j)
            G[i][j] = g[i][j];
    }

    for (int i=0; i<n; ++i)
        dp[1][i][0] = 1;
    for (int i=1; i<n; ++i) {
        for (int j=0; j<n; ++j)
        for (int mask=0; mask<(1<<n); ++mask) {

            if (dp[i][j][mask]) {
                for (int k=0; k<n; ++k) {
                    if (j == k)
                        continue;
                    int nmask = mask << 1 | (G[j][k]);
                    dp[i+1][k][nmask] += dp[i][j][mask];
                }
            }
        }
    }

    for (int i=0; i<(1<<(n-1)); ++i) {
        LL ans = 0;
        for (int j=0; j<n; ++j)
            ans += dp[n][j][i];
        printf("%lld%c", ans, i==(1<<(n-1))-1 ? '\n' : ' ');
    }
    return 0;
}
